package entityDAOs;

import java.util.Date;
import java.util.List;
import java.util.Set;
import org.hibernate.LockMode;
import org.hibernate.Query;
import static org.hibernate.criterion.Example.create;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import entities.User;

/**
 * A data access object (DAO) providing persistence and search support for User
 * entities. Transaction control of the save(), update() and delete() operations
 * can directly support Spring container-managed transactions or they can be
 * augmented to handle user-managed Spring transactions. Each of these methods
 * provides additional information for how to configure it for the desired type
 * of transaction control.
 * 
 * @see entities.User
 * @author MyEclipse Persistence Tools
 */

public class UserDAO extends BaseHibernateDAO<User,java.lang.Integer> {
	private static final Logger log = LoggerFactory.getLogger(UserDAO.class);
	// property constants
	public static final String EMAIL = "email";
	public static final String PASSWORD = "password";
	public static final String NICKNAME = "nickname";
	public static final String ID_FACEBOOK = "idFacebook";
	public static final String FIRST_NAME = "firstName";
	public static final String LAST_NAME = "lastName";
	public static final String PHOTO = "photo";
	public static final String TOTAL_POINTS = "totalPoints";

	public List<User> findByEmail(Object email) {
		return findByProperty(EMAIL, email);
	}

	public List<User> findByPassword(Object password) {
		return findByProperty(PASSWORD, password);
	}

	public List<User> findByNickname(Object nickname) {
		return findByProperty(NICKNAME, nickname);
	}

	public List<User> findByIdFacebook(Object idFacebook) {
		return findByProperty(ID_FACEBOOK, idFacebook);
	}

	public List<User> findByFirstName(Object firstName) {
		return findByProperty(FIRST_NAME, firstName);
	}

	public List<User> findByLastName(Object lastName) {
		return findByProperty(LAST_NAME, lastName);
	}

	public List<User> findByPhoto(Object photo) {
		return findByProperty(PHOTO, photo);
	}

	public List<User> findByTotalPoints(Object totalPoints) {
		return findByProperty(TOTAL_POINTS, totalPoints);
	}
}